/*var user = new Object();
user.name = "xx";
user.getName = function(){
	return this.name;
}
console.trace("trace");*/



/*console.time("small loop");
for(var i=0; i<10000000; i++){;}
console.timeEnd("small loop");*/







/*var testModule1 = require("./testModule.js");
var testModule2 = require("./testModule.js");

testModule1.outputTestVar("testModule1");
testModule2.outputTestVar("testModule2");

console.log(require.resolve("./testModule"));
console.log(__filename);
console.log(__dirname);*/
// console.log(testModule.testVar);

// if(module == require.main){
// 	console.log("This is the main module of application.")
// }



var http = require("http");
var events = require("events");
var server = http.createServer();

/*server.on('removeListener', function(e,f){
	console.log("remove event: " + e);
	console.log(f);
});

server.on('newListener', function(e,f){
	console.log("add event: " + e);
	console.log(f);
});*/


/*var testFunciton = function(req, res){
	if(req.url !== "/favicon.ico"){
		console.log('received a request');
	}
}

server.once('request',testFunciton);*/



server.on('request', function(req, res){
	if(req.url !== "/favicon.ico"){
		console.log('received a request');
	}
});

server.on('request', function(req, res){
	if(req.url !== "/favicon.ico"){
		console.log(req.url);
	}
});

server.on('request', function(req, res){
	if(req.url !== "/favicon.ico"){
		console.log("finish");
	}
	res.end();
	// server.emit("xx","haha","lala");

});

server.listen(8111);
// console.log(server.listeners("request"));

// server.on("xx", function(p1,p2){
// 	console.log(p1);
// 	console.log(p2);
// });
// server.removeListener("request", testFunciton);

console.log(events.EventEmitter.listenerCount(server, 'request'));
